<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<meta name="renderer" content="webkit" />
	<link href="../css/bootstrap.min.css" rel="stylesheet" />
	<link href="../css/font-awesome.min.css" rel="stylesheet" />
	<link href="../css/animate.css" rel="stylesheet" />
	<link href="../css/style.css" rel="stylesheet" />
	<link href="../css/plugins/toastr/toastr.min.css" rel="stylesheet">
</head>
<body class="top-navigation">
	<div id="wrapper">
		<div id="page-wrapper" class="gray-bg dashbard-1">
			<div class="row border-bottom">
<nav class="navbar navbar-static-top" data-role="navigation">
<!-- 以下是顶部导航栏，需要根据页面配置 -->
					<div class="navbar-header">
						<div class="minimalize-styl-2">
						
<!-- 请确保下面的<a>标签中的href属性地址和相对路径一致 -->
							<a class="btn btn-success" title="返回主页" href="main.html"><i class="fa fa-lg fa-home"></i></a>
<!-- 请确保上面的<a>标签中的href属性地址和相对路径一致 -->

							<a class="back-link btn btn-success" title="后退"><i class="fa fa-lg fa-arrow-left"></i></a>
							<a class="reload-link btn btn-success" title="重新加载"><i class="fa fa-lg fa-repeat"></i></a>

<!-- 以下是指示页面上下文的部分，需要根据实际路径修改 -->
							<ol id="guide" class="breadcrumb m-l">
<!-- <li><a>上级页面的上级页面</a><li> -->
<!-- <li><a>上级页面</a><li> -->
<!-- <li><strong>当前页面</strong><li> -->
								<li><strong>主页</strong></li>
							</ol>
<!-- 以上是指示页面上下文的部分，需要根据实际路径修改 -->

						</div>
					</div>
					<div class="nav navbar-top-links navbar-right minimalize-styl-2">
						<span class="m-r-sm text-muted welcome-message btn btn-link">欢迎使用Feces物流管理系统</span>
					</div>
<!-- 以上是顶部导航栏，需要根据页面配置 -->
				</nav>
			</div>
			
			
			
			
			<!-- 配置点2 -->
			<!-- 内容 -->
			<div class="wrapper wrapper-content animated fadeInRight">
			
			
			
			
				<!-- 配置点2.1 -->
				<!-- 段落1 -->
				<div class="row">
					<div class="col-lg-12">
						<div class="ibox float-e-margins">
							<div class="ibox-title">
								<h5>信息录入</h5>
							</div>
							<div class="ibox-content">
								<div class="loginscreen   animated fadeInDown">
									<div>
										<h3>欢迎进入客户注册界面</h3>
										<p>创建一个新客户</p>
										<form class="m-t" data-role="form" id="form">
											<div class="form-group">
												<label class="label label-success">姓名</label>
												<input type="text" class="form-control" id="in_name" placeholder="请输入用户名" required>
											</div>
											<div class="form-group">
												<label class="label label-success">身份证号</label>
												<input type="text" class="form-control" id="in_adc" placeholder="请输入身份证号,15-18位数字" name="idc_number" required>
											</div>
											<div class="form-group">
												<label class="label label-success">手机号码</label>
												<input type="text" class="form-control" id="in_mp" placeholder="请输入手机号码" name="mp" required>
											</div>
											<p><span class="label label-success" id="add_info">详细信息</span></p>
											<div class="a" style="display:none;">
												<label  class="label label-success">单位名称</label>
												<input type="text" class="form-control" id="in_bu" placeholder="请输入单位名称" >
											</div>
											<div class="a" style="display:none;">
												<label  class="label label-success">固定电话</label>
												<input type="text" class="form-control" id="in_p" placeholder="固定电话" name="phone">
											</div>
											<div class="a" style="display:none;">
												<label  class="label label-success">家庭住址</label>
												<input type="text" class="form-control" id="in_add" placeholder="家庭住址" >
											</div>
											<div class="a" style="display:none;">
												<label  class="label label-success">邮政编码</label>
												<input type="text" class="form-control" id="in_mail" placeholder="邮政编码" name="mail">
											</div>
											<div class="a" style="display:none;">
												<label  class="label label-success">电子邮件</label>
												<input type="email" class="form-control" id="in_email" placeholder="电子邮件" required="">
											</div>
											<button type="button" onclick="addClient()" class="btn btn-success block full-width m-b">注 册</button>
										</form>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
								<!-- 配置点2.2 -->
				<!-- 段落2 -->
				<div class="row">
					<div class="col-lg-12">
						<div class="ibox float-e-margins">
							<div class="ibox-title">
								<h5>段落2标题</h5>
							</div>
							<div class="ibox-content">
								<h5>段落2内容</h5>
							</div>
						</div>
					</div>
				</div>
				
				
				
				<!-- 配置点2.x -->
				<!-- ... -->
				
	
				
			</div>
		</div>
	</div>
	<script src="../js/jquery-2.1.1.min.js"></script>
	<script src="../js/bootstrap.min.js"></script>
	<script src="../js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="../js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="../js/hplus.js"></script>
	<script src="../js/plugins/pace/pace.min.js"></script>
	<script src="../js/plugins/toastr/toastr.min.js"></script>
	    <!-- Jquery Validate -->
    <script src="../js/plugins/validate/jquery.validate.min.js"></script>

    <script src="../js/plugins/validate/messages_zh.min.js"></script>
	
	
	<!-- 配置点3 -->
	<!-- 载入后的js脚本 -->
	<script>
$(function(){
	// you JavaScript code here!
});
$(document).ready(function(){
	$("#add_info").click(function(){
		$(this).hide();
		$(".a").fadeIn("slow");
	});
	});
$(document).ready(function () {
	jQuery.validator.addMethod("isZipCode", function(value, element) {   
	    var tel = /^[0-9]{6}$/;
	    return this.optional(element) || (tel.test(value));
	}, "邮政编码为6位数字");
	jQuery.validator.addMethod("isIdCard", function(value, element) {   
	    var tel = /^(\d{18,18}|\d{15,15}|\d{17,17}x)$/;
	    return this.optional(element) || (tel.test(value));
	}, "身份证卡号为15位或18位数字或17位数字+x");
	jQuery.validator.addMethod("ismp", function(value, element) {   
	    var tel = /^[0-9]{11}$/;
	    return this.optional(element) || (tel.test(value));
	}, "手机为11位数字");
	jQuery.validator.addMethod("isp", function(value, element) {   
	    var tel = /0\d{2,3}-\d{5,9}|0\d{2,3}-\d{5,9}/;
	    return this.optional(element) || (tel.test(value));
	}, "固定电话:区号（0xx或0xxx）-（五到九个数字）-(五到九个数字)");
    $("#form").validate({
        rules: {
        	mp:{
        		required:true,
        		number:true,
        		ismp:true
        	},
        	phone:{
        		required:true,
        		isp:true
        	},
            mail: {
                required: true,
                number: true,
                isZipCode:true
            },
            idc_number: {
                required: true,
                number: true,
                isIdCard:true
            }
        }
    });
});
	var url="../api/cl";
	function addClient()
	{
		var name=$("#in_name").val();
		var idc=$("#in_adc").val();
		var mp=$("#in_mp").val();
		var p=$("#in_p").val();
		var mail=$("#in_mail").val();
		var add=$("#in_add").val();
		var email=$("#in_email").val();
		var bu=$("#in_bu").val();
		$.ajax({
			type: "POST",
			url: url,
			data: {
				name    : name,
				mphone  : mp,
				id_card : idc,
				phone   : p,
				mail    : mail,
				email   : email,
				bu      : bu,
				address : add
			},
			success: function(result){
				alert("恭喜你注册成功，你的id是"+result.data);
			}
		});
		
	}	
	</script>

	
	
	
</html>
